SimpleConcepts: A lightweight extension to C++ to support constraints on generic types
نویسندگان
چکیده
Generic programming plays an essential role in C++ software through the use of templates. However, both the creation and use of template libraries is hindered by the fact that the language does not allow programmers to specify constraints on generic types. To date, no proposal to update the language to provide concepts has survived the committee process. Until that time comes, as a form of early support, this paper introduces SimpleConcepts, an extension to C++11 that provides support for concepts, sets of constraints on generic types. SimpleConcepts features are parsed according to an island grammar and source-to-source translation is used to lower concepts to pure C++11 code.
منابع مشابه
Genus: Making Generics Object-Oriented, Expressive, and Lightweight Technical Report
The support for generic programming in modern object-oriented programming languages is awkward and lacks desirable expressive power. We introduce an expressive genericity mechanism that adds expressive power and strengthens static checking, while remaining lightweight and simple in common use cases. Like type classes and concepts, the mechanism allows existing types to model type constraints re...
متن کاملAn extended comparative study of language support for generic programming
Many modern programming languages support basic generics, sufficient to implement type-safe polymorphic containers. Some languages have moved beyond this basic support, and in doing so have enabled a broader, more powerful form of generic programming. This paper reports on a comprehensive comparison of facilities for generic programming in eight programming languages: C++, Standard ML, Objectiv...
متن کاملIntroducing a Lightweight Structural Model via Simulation of Vernacular “Pa Tu Pa” Arch
The knowledge of Iranian vernacular structures is based on geometry, and there is a possibility of recreating such structural patterns aimed at producing movable structures. The purpose of this research was to utilize the patterns of vernacular structures to provide a lightweight structural model. The questions raised included how to create various forms based on the structural history of any r...
متن کاملVariance and Generalized Constraints for C# Generics
Generic types in C behave invariantly with respect to subtyping. We propose a system of type-safe variance for C that supports the declaration of covariant and contravariant type parameters on generic types. To support more widespread application of variance we also generalize the existing constraint mechanism with arbitrary subtype assertions on classes and methods. This extension is useful ev...
متن کاملSemantics-Driven Genericity: A Sequel to the Static C++ Object-Oriented Programming Paradigm (SCOOP 2)
Classical (unbounded) genericity in C++03 defines the interactions between generic data types and algorithms in terms of concepts. Concepts define the requirements over a type (or a parameter) by expressing constraints on its methods and dependent types (typedefs). The upcoming C++0x standard will promote concepts from abstract entities (not directly enforced by the tools) to language construct...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید
ثبت ناماگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید
ورودعنوان ژورنال:
- Comput. Sci. Inf. Syst.
دوره 11 شماره
صفحات -
تاریخ انتشار 2014